﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using NPSoft.Ferrero.Framework.DAL;

namespace NPSoft.Ferrero.DataBridge.DAL
{
    public class GetResultDataUtil
    {
        /// <summary>
        /// SQL连接
        /// </summary>
        private SqlConnection Connection
        {
            get
            {
                return SqlHelper.GetConnection();
            }
        }

        #region "获取错误数据"

        /// <summary>
        /// 获取Error Data
        /// </summary>
        /// <returns></returns>
        public DataTable GetInErrorData(int which)
        {
            DataSet ds = new DataSet();
            SqlParameter[] param = new SqlParameter[1];
            param[0] = new SqlParameter("@which", which);
            ds = SqlHelper.ExecuteDataset(this.Connection, "usp_IN_GetErrorData", param);

            return ds.Tables[0];
        }

        /// <summary>
        /// 获取Error Data
        /// </summary>
        /// <returns></returns>
        public DataTable GetInErrorMsgData(int which)
        {
            DataSet ds = new DataSet();
            SqlParameter[] param = new SqlParameter[1];
            param[0] = new SqlParameter("@which", which);
            ds = SqlHelper.ExecuteDataset(this.Connection, "usp_IN_GetErrorMsg", param);

            return ds.Tables[0];
        }


        #endregion

        #region "获取正确数据"

        /// <summary>
        /// 获取Increment Data
        /// </summary>
        /// <returns></returns>
        public DataTable GetInSuccessData(int which)
        {
            DataSet ds = new DataSet();
            SqlParameter[] param = new SqlParameter[1];
            param[0] = new SqlParameter("@which", which);
            ds = SqlHelper.ExecuteDataset(this.Connection, "usp_IN_GetSuccessData", param);

            return ds.Tables[0];
        }

        #endregion

        #region "获取总数据"

        /// <summary>
        /// 获取Total Data
        /// </summary>
        /// <returns></returns>
        public DataTable GetInTotalData(int which)
        {
            DataSet ds = new DataSet();
            SqlParameter[] param = new SqlParameter[1];
            param[0] = new SqlParameter("@which", which);
            ds = SqlHelper.ExecuteDataset(this.Connection, "usp_IN_GetTotalData", param);

            return ds.Tables[0];
        }

        #endregion
        
    }
}
